package com.example.zk1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.mvp.view.BaseActivity;
import com.example.zk1.bean.RegBean;
import com.example.zk1.contract.LoginContract;
import com.example.zk1.model.LoginModel;
import com.example.zk1.presenter.LoginPresenter;

public class RegActivity extends BaseActivity<LoginPresenter> implements LoginContract.RegisterView {
    private EditText etapiKey;
    private EditText etName;
    private EditText etPwd;
    private Button btKey;
    LoginPresenter loginPresenter;



    @Override
    public int bindLayout() {
        return R.layout.activity_reg;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        etapiKey = (EditText) findViewById(R.id.et_key);
        etName = (EditText) findViewById(R.id.et_name);
        etPwd = (EditText) findViewById(R.id.et_pwd);
        btKey = (Button) findViewById(R.id.bt_key);

        btKey.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                loginPresenter.requestRegister();
            }
        });
    }

    @Override
    public void inject() {
        loginPresenter = new LoginPresenter(new LoginModel(), this);

    }

    @Override
    public String getApikey() {
        return etapiKey.getText().toString().trim();
    }

    @Override
    public String getUsername() {
        return etName.getText().toString().trim();
    }

    @Override
    public String getpwd() {
        return etPwd.getText().toString().trim();
    }

    @Override
    public void goMain() {
        Intent intent = new Intent(RegActivity.this, LogActivity.class);
        startActivity(intent);

    }
}
